# 两数之和
self = []
nums = [3,3]
target = 6
def twoSum(self, nums, target):
    """
    :type nums: List[int]
    :type target: int
    :rtype: List[int]
    """
    # result = []
    # for i,num in enumerate(nums):
    #     complement = target - num
    #     if (complement in nums) and (nums.index(complement) != i):
    #         result.append(i)
    #         result.append(nums.index(complement))
    #         return result
    result = {}
    for i,num in enumerate(nums):
        complement = target - num
        if complement in result:
            return [result[complement],i]
        result[num] = i

self = twoSum(self, nums, target)
print(self)